﻿using System.Linq;

namespace YawetagLib.Data.L2EF
{
    public abstract class Repository<TEntity> : QueryableRepository<TEntity> where TEntity : class
    {
        protected Repository(IDataContext dataContext)
            : base(dataContext)
        {
            DataSource = DataContext.GetDataSource<TEntity>();
        }

        protected IQueryable<TEntity2> GetDataSet<TEntity2>() where TEntity2 : class
        {
            return DataContext.GetDataSet<TEntity2>().ToExtendedSet();
        }

        protected override IQueryable<TEntity> Queryable
        {
            get { return GetDataSet<TEntity>(); }
        }
    }
}
